package @@packageName@@;

import com.google.gwt.json.client.*;

public class PrimitiveArrayJsonizer {
    public static char[] toJavaChar(JSONValue arg0) {
        if (arg0.isNull() != null) {
            return null;
        }

        JSONArray jsonArray = arg0.isArray();
        char[] outputArray = new char[jsonArray.size()];

        for (int i = 0, n = jsonArray.size(); i < n; i++) {
            outputArray[i] = PrimitiveJsonizer.toJavaChar(jsonArray.get(i));
        }

        return outputArray;
    }

    public static boolean[] toJavaBoolean(JSONValue arg0) {
        if (arg0.isNull() != null) {
            return null;
        }

        JSONArray jsonArray = arg0.isArray();
        boolean[] outputArray = new boolean[jsonArray.size()];

        for (int i = 0, n = jsonArray.size(); i < n; i++) {
            outputArray[i] = PrimitiveJsonizer.toJavaBoolean(jsonArray.get(i));
        }

        return outputArray;
    }

    public static short[] toJavaShort(JSONValue arg0) {
        if (arg0.isNull() != null) {
            return null;
        }

        JSONArray jsonArray = arg0.isArray();
        short[] outputArray = new short[jsonArray.size()];

        for (int i = 0, n = jsonArray.size(); i < n; i++) {
            outputArray[i] = PrimitiveJsonizer.toJavaShort(jsonArray.get(i));
        }

        return outputArray;
    }

    public static int[] toJavaInteger(JSONValue arg0) {
        if (arg0.isNull() != null) {
            return null;
        }

        JSONArray jsonArray = arg0.isArray();
        int[] outputArray = new int[jsonArray.size()];

        for (int i = 0, n = jsonArray.size(); i < n; i++) {
            outputArray[i] = PrimitiveJsonizer.toJavaInteger(jsonArray.get(i));
        }

        return outputArray;
    }

    public static long[] toJavaLong(JSONValue arg0) {
        if (arg0.isNull() != null) {
            return null;
        }

        JSONArray jsonArray = arg0.isArray();
        long[] outputArray = new long[jsonArray.size()];

        for (int i = 0, n = jsonArray.size(); i < n; i++) {
            outputArray[i] = PrimitiveJsonizer.toJavaLong(jsonArray.get(i));
        }

        return outputArray;
    }

    public static float[] toJavaFloat(JSONValue arg0) {
        if (arg0.isNull() != null) {
            return null;
        }

        JSONArray jsonArray = arg0.isArray();
        float[] outputArray = new float[jsonArray.size()];

        for (int i = 0, n = jsonArray.size(); i < n; i++) {
            outputArray[i] = PrimitiveJsonizer.toJavaFloat(jsonArray.get(i));
        }

        return outputArray;
    }

    public static double[] toJavaDouble(JSONValue arg0) {
        if (arg0.isNull() != null) {
            return null;
        }

        JSONArray jsonArray = arg0.isArray();
        double[] outputArray = new double[jsonArray.size()];

        for (int i = 0, n = jsonArray.size(); i < n; i++) {
            outputArray[i] = PrimitiveJsonizer.toJavaDouble(jsonArray.get(i));
        }

        return outputArray;
    }

    public static JSONValue toJsonChar(char[] arg0) {
        if (arg0 == null) {
            return JSONNull.getInstance();
        }

        JSONArray outputArray = new JSONArray();
        for (int i = 0, n = arg0.length; i < n; i++) {
            outputArray.set(i, new JSONString("" + arg0[i]));
        }

        return outputArray;
    }

    public static JSONValue toJsonBoolean(boolean[] arg0) {
        if (arg0 == null) {
            return JSONNull.getInstance();
        }

        JSONArray outputArray = new JSONArray();
        for (int i = 0, n = arg0.length; i < n; i++) {
            outputArray.set(i, JSONBoolean.getInstance(arg0[i]));
        }

        return outputArray;
    }

    public static JSONValue toJsonShort(short[] arg0) {
        if (arg0 == null) {
            return JSONNull.getInstance();
        }

        JSONArray outputArray = new JSONArray();
        for (int i = 0, n = arg0.length; i < n; i++) {
            outputArray.set(i, new JSONNumber(arg0[i]));
        }

        return outputArray;
    }

    public static JSONValue toJsonInteger(int[] arg0) {
        if (arg0 == null) {
            return JSONNull.getInstance();
        }

        JSONArray outputArray = new JSONArray();
        for (int i = 0, n = arg0.length; i < n; i++) {
            outputArray.set(i, new JSONNumber(arg0[i]));
        }

        return outputArray;
    }

    public static JSONValue toJsonLong(long[] arg0) {
        if (arg0 == null) {
            return JSONNull.getInstance();
        }

        JSONArray outputArray = new JSONArray();
        for (int i = 0, n = arg0.length; i < n; i++) {
            outputArray.set(i, new JSONNumber(arg0[i]));
        }

        return outputArray;
    }

    public static JSONValue toJsonFloat(float[] arg0) {
        if (arg0 == null) {
            return JSONNull.getInstance();
        }

        JSONArray outputArray = new JSONArray();
        for (int i = 0, n = arg0.length; i < n; i++) {
            outputArray.set(i, new JSONNumber(arg0[i]));
        }

        return outputArray;
    }

    public static JSONValue toJsonDouble(double[] arg0) {
        if (arg0 == null) {
            return JSONNull.getInstance();
        }

        JSONArray outputArray = new JSONArray();
        for (int i = 0, n = arg0.length; i < n; i++) {
            outputArray.set(i, new JSONNumber(arg0[i]));
        }

        return outputArray;
    }
}
